<template>
    <div>
        <h1>页面跳转中。。。</h1>
        <h2>获取的微博code是:{{ weibo_code }}</h2>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name:'weibo_callback',
    data(){
        return{
            weibo_code:""
        }
    },
    methods:{
        get_weibo_code(){
            var code = this.$route.query.code
            console.log(code)
            this.weibo_code=code
            
        },
        send_code(){
            send_code().then(res=>{
                console.log(res)
            })
        }
        // send_code(){
        //      axios({
        //         url:"http://127.0.0.1:8000/users/weibo_code/",
        //         method:"get",
        //         params:{"code":this.weibo_code}
        //      })
            // }).then(res=>{
            //     console.log(res.data)
            //      if(res.data.code==200){
            //         sessionStorage.setItem("jwt_token",res.data.token)
            //         window.location.href="https://www.baidu.com"
            //     }else if(res.data.code==404){
            //        sessionStorage.setItem("u_id",res.data.uid)
            //        this.$router.push({path:"/simuser"}) 
            //     }else{
            //         alert("微博登录失败，请重新登录")
                
            //     }
            // })
    //     }
    },
    mounted(){
        this.get_weibo_code()
        this.send_code()
    }
}
</script>



https://api.weibo.com/oauth2/authorize?
client_id=220876075
3&response_type=code&
redirect_uri=http%3A%2F%2F127.0.0.1%3A8080%2F%23%2Fweibo_callback%2F